# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.VectorTile.V1.Model.TileCoordinates do
  @moduledoc """
  Global tile coordinates. Global tile coordinates reference a specific tile on the map at a specific zoom level. The origin of this coordinate system is always at the northwest corner of the map, with x values increasing from west to east and y values increasing from north to south. Tiles are indexed using x, y coordinates from that origin. The zoom level containing the entire world in a tile is 0, and it increases as you zoom in. Zoom level n + 1 will contain 4 times as many tiles as zoom level n. The zoom level controls the level of detail of the data that is returned. In particular, this affects the set of feature types returned, their density, and geometry simplification. The exact tile contents may change over time, but care will be taken to keep supporting the most important use cases. For example, zoom level 15 shows roads for orientation and planning in the local neighborhood and zoom level 17 shows buildings to give users on foot a sense of situational awareness.

  ## Attributes

  *   `x` (*type:* `integer()`, *default:* `nil`) - Required. The x coordinate.
  *   `y` (*type:* `integer()`, *default:* `nil`) - Required. The y coordinate.
  *   `zoom` (*type:* `integer()`, *default:* `nil`) - Required. The Google Maps API zoom level.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :x => integer() | nil,
          :y => integer() | nil,
          :zoom => integer() | nil
        }

  field(:x)
  field(:y)
  field(:zoom)
end

defimpl Poison.Decoder, for: GoogleApi.VectorTile.V1.Model.TileCoordinates do
  def decode(value, options) do
    GoogleApi.VectorTile.V1.Model.TileCoordinates.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.VectorTile.V1.Model.TileCoordinates do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
